/**
 * Created by win 10 on 1/10/2018.
 */
import Vue from 'vue'
import Vuex from 'vuex'

import state from './state'
import getters from './getter'
import actions from './actions'
import mutations from './mutations'

Vue.use(Vuex)

const store = new Vuex.Store({ // Store(S大写)A constructor name should not start with a lowercase letter
  state,
  getters,
  actions,
  mutations
})

export default store

// import Vue from 'vue'
// import Vuex from 'vuex'
// Vue.use(Vuex)
// const state = {
//   count: 0
// }
// const mutations = {
//   increment (state) {
//     state.count -= 5
//   }
// }
// const actions = {
//   increment: ({commit}) => commit({type: 'increment', amount: 10}),
//   incrementIfOdd ({ commit, state }) {
//     if ((state.count + 1) % 2 === 0) {
//       commit('increment')
//     }
//   }
// }
// const getters = {
//   evenOrOdd1: state => state.count % 2 === 0 ? 'even' : 'odd'
// }
// export default new Vuex.Store({
//   state,
//   getters,
//   actions,
//   mutations
// })
